// Property5Dlg.cpp : implementation file
//

#include "stdafx.h"
#include "Property5.h"
#include "Property5Dlg.h"
#include "mwrf32.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

using namespace std;
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
	CAboutDlg();
    
// Dialog Data
	//{{AFX_DATA(CAboutDlg)
	enum { IDD = IDD_ABOUTBOX };
	CString	m_intr;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CAboutDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	//{{AFX_MSG(CAboutDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnButtonWeb();
	afx_msg void OnStaticWeb();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
	//{{AFX_DATA_INIT(CAboutDlg)
	m_intr = _T("");
	//}}AFX_DATA_INIT
	

}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAboutDlg)
	DDX_Text(pDX, IDC_EDIT_INTR, m_intr);
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
	//{{AFX_MSG_MAP(CAboutDlg)
//	ON_BN_CLICKED(IDC_BUTTON_WEB, OnButtonWeb)
	ON_BN_CLICKED(IDC_STATIC_WEB, OnStaticWeb)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CProperty5Dlg dialog

CProperty5Dlg::CProperty5Dlg(CWnd* pParent /*=NULL*/)
	: CDialog(CProperty5Dlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CProperty5Dlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CProperty5Dlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CProperty5Dlg)
	DDX_Control(pDX, IDC_TAB1, m_sheet);
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CProperty5Dlg, CDialog)
	//{{AFX_MSG_MAP(CProperty5Dlg)
	ON_WM_SYSCOMMAND()
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_WM_KEYDOWN()
	ON_WM_CLOSE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CProperty5Dlg message handlers
CAboutDlg m_about;
BOOL CProperty5Dlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Add "About..." menu item to system menu.

	// IDM_ABOUTBOX must be in the system command range.
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != NULL)
	{
		CString strAboutMenu;
		strAboutMenu.LoadString(IDS_ABOUTBOX);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	// TODO: Add extra initialization here
	
	m_sheet.AddPage("Device Op", &m_page1, IDD_DIALOG1);
	m_sheet.AddPage("RF Card", &m_page2, IDD_DIALOG2);
	m_sheet.AddPage("About",&m_about,IDD_ABOUTBOX);
	
	m_sheet.Show();
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}

void CProperty5Dlg::OnSysCommand(UINT nID, LPARAM lParam)
{
	if ((nID & 0xFFF0) == IDM_ABOUTBOX)
	{
		CAboutDlg dlgAbout;
		dlgAbout.DoModal();
	}
	else
	{
		CDialog::OnSysCommand(nID, lParam);
	}
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CProperty5Dlg::OnPaint() 
{
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
	}
}

// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CProperty5Dlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}

void CProperty5Dlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
	// TODO: Add your message handler code here and/or call default
	CDialog::OnCancel();
	CDialog::OnKeyDown(nChar, nRepCnt, nFlags);
}

void CProperty5Dlg::OnCancel() 
{
	// TODO: Add extra cleanup here
	
	CDialog::OnCancel();
}

void writeData();
void CProperty5Dlg::OnClose() 
{
	// TODO: Add your message handler code here and/or call default
	if(IDYES!=MessageBox("Are you sure close system?","Warning",MB_YESNO))
	{
		return ;
	}

	writeData();
	
	CDialog::OnClose();
}

BOOL CAboutDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
//	m_intr="A bout setchief electronics:\r\n\r\n1. We supply products and technology for you as follows:\r\n\r\n2. The whole technology of ensuring electronic products against copy, involving the demo, the developer and the target programs (C language & assemble of MCS-51 ), reader of AT88SCXXXX(AT88SC0104C~AT88SC1616C~AT88SC25616C), reader of AT88SCRFXXXX(New product).\r\n\r\n3. The set of cracking/decoding/decipher/decrypting security code of SLE4442 or SLE4428.AT88SC102/AT88SC1604\r\n\r\n4. The set of cracking/ decoding/decipher/ decrypting keys to clone/ copy DS1991 or DS1425, or copying/ developing of DS1961S.\r\n\r\n5. Copy/clone DS1982, DS1990;\r\n\r\n6. Clone/ copy/ Simulating replacing ROMs of TM Card/ iButton.\r\n\r\n7. Decrypt/decode/crack Mifare 1 card.\r\n\r\n7. Decode/crack/decrypt/decipher T5557/5567/E5550\r\n\r\nIf you have any need above, contact us at once please!\r\n\r\nTel:008620-85662866   Fax: 008620-28315520   MOBILE: 0086-13710680786   E-mail: shichengdz@163.com";
//	UpdateData(false);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CAboutDlg::OnButtonWeb() 
{
	// TODO: Add your control notification handler code here
//	ShellExecute(m_hWnd,"open","http://www.setchief.com/", NULL, NULL, SW_SHOWNORMAL);
	
}

void CAboutDlg::OnStaticWeb() 
{
	// TODO: Add your control notification handler code here
//	ShellExecute(m_hWnd,"open","http://www.setchief.com/", NULL, NULL, SW_SHOWNORMAL);
}
